<?php
/**
 * Created by PhpStorm.
 * User: zhang
 * Date: 2018/2/9
 * Time: 12:34
 */
$arr    = [ 'C', 'PHP', 'Java', 'Go', 'Python', 'JavaScript' ];
$result = array_slice( $arr, 2 );
print_r( $result );//0 => Java ,1 => GO,2=>Python,3=>JavaScript
$result = array_slice( $arr, 2, 1 );
print_r( $result ); //0 => Java
$result = array_slice( $arr, 2, 1, true );
print_r( $result ); //2 => Java

$result = array_slice( $arr, - 3 );
print_r( $result );//0=>Go,1=>Python,2=>JavaScript
$result = array_slice( $arr, - 3, 1 );
print_r( $result );//0=>Go
$result = array_slice( $arr, - 3, 1, true );
print_r( $result );//3=>Go

$result = array_slice( $arr, 2, - 1 );
print_r( $result );//0=>Java,1=>Go,2=>Python
$result = array_slice( $arr, - 3, 1 );
print_r( $result );//0=>Go
$result = array_slice( $arr, - 3, - 1 );
print_r( $result );//0=>Go,0=>Python
